<template>
  <div>
    <van-nav-bar
      title="咨询详情"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="xinwenzix">
      <h3>{{ news.title }}</h3>
      <h5>{{ news.newsTime }}</h5>
      <img :src="news.image" :alt="news.title" class="image" />
      <p>{{ news.content }}</p>
    </div>
  </div>
</template>
<script>
import axios from "axios";

export default {
  data() {
    return {
      news: {},
      id:''
    }
  },
  created() {
    this.id = this.$route.params.id
    console.log(this.id)
    this.findOnenews()
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1)
    },
   findOnenews(){
     axios.get(`/news/detail/${this.id}`).then(response => {
       console.log(response)
       this.news = response.data
     })
   }
  },

}
</script>

<style scoped>
.xinwenzix {
  margin-top: 10px;
  margin-left: 10px;
  margin-right: 10px;
}
.image {
  width: 100%;
  height: 300px;
}
h3 {
  text-align: left;
}
h5 {
  text-align: left;
  color: #bfbbbb;
}
p {
  text-align: left;
  margin-top: 5px;
}
</style>
